-
Notifications
You must be signed in to change notification settings - Fork 240
Split by lines when parsing stdout of build #1276
Conversation
@@ -725,9 +725,14 @@ export class ArduinoApp { | |||
} | |||
return ret; | |||
} | |||
let stdoutbuf = "" | |||
const stdoutcb = (line: string) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name line
is obviously misleading since it really is chunks of stdout text, not specifically split into lines, so this name should be updated as well.
I suggest stdoutText
which is descriptive and also matches the documentation to the spawn
function in src/common/util.ts (which is missing an update to match its current parameters, great if you could fix that as well).
With a rename of the function argument in stdoutcb
(and fix stderrcb
as well at the same time), then you could use stdoutText
directly without needing to copy to a stdoutbuf
variable.
let lines = [stdoutbuf]; | ||
lines = stdoutbuf.split('\n'); | ||
stdoutbuf += line; | ||
let lines = stdoutbuf.split('\n'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const lines = ...
let lines = [stdoutbuf]; | ||
lines = stdoutbuf.split('\n'); | ||
stdoutbuf += line; | ||
let lines = stdoutbuf.split('\n'); | ||
stdoutbuf = lines.pop()!; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This statement can be removed, there is no point in updating stdoutbuf
after its last usage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The stdoutbuf is upvalue variable of the closure, the last update is taking the remain characters that in last line.
close as #1494 merged |
Fixes #1275